package com.tsystems.tuni.sportplanet.businesslogic;

import java.util.List;

import javax.ejb.Stateless;

import com.tsystems.tuni.sportplanet.businesslogic.accessinterfaces.ReadDataBeanLocal;
import com.tsystems.tuni.sportplanet.businesslogic.accessinterfaces.ReadDataBeanRemote;
import com.tsystems.tuni.sportplanet.dao.GameDAO;
import com.tsystems.tuni.sportplanet.dao.GameDAOImpl;
import com.tsystems.tuni.sportplanet.dao.PlayerDAO;
import com.tsystems.tuni.sportplanet.dao.PlayerDAOImpl;
import com.tsystems.tuni.sportplanet.dao.SportDAO;
import com.tsystems.tuni.sportplanet.dao.SportDAOImpl;
import com.tsystems.tuni.sportplanet.dao.TeamDAO;
import com.tsystems.tuni.sportplanet.dao.TeamDAOImpl;
import com.tsystems.tuni.sportplanet.entity.Game;
import com.tsystems.tuni.sportplanet.entity.Player;
import com.tsystems.tuni.sportplanet.entity.Sport;
import com.tsystems.tuni.sportplanet.entity.Team;

/**
 * @author Ippolitov Anton, Yuriy Eremin
 */
@Stateless
public class ReadDataBeanImpl implements ReadDataBeanLocal, ReadDataBeanRemote {

	private SportDAO sportDAO = new SportDAOImpl();
	private TeamDAO teamDAO = new TeamDAOImpl();
	private PlayerDAO playerDAO = new PlayerDAOImpl();
	private GameDAO gameDAO = new GameDAOImpl();

	public List<Sport> getAllSports() {
		return sportDAO.getAll(Sport.class);
	}

	public List<Team> getSportTeams(Sport sport) {
		return teamDAO.getTeamsBySport(sport);
	}

	public List<Player> getTeamsPlayer(Team team) {
		return playerDAO.getAllPlayersFromTeam(team);
	}

	public List<Game> getGamesBySport(Sport sport) {
		return gameDAO.getGamesBySport(sport);
	}

}
